var n;
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.BuffMgr = undefined;
var EventManager = require("AA_EventManager");
var SingletonManager = require("AA_SingletonManager");
var CommonUtils = require("AA_CommonUtils");
var EvenType = require("AA_EvenType");
var PlayerDataManager = require("AA_PlayerDataManager");
var Excel = require("AA_Excel");
var ExcelUtil = require("AA_ExcelUtil");
var HallGlobalVariable = require("AA_HallGlobalVariable");
var GameDataManager = require("AA_GameDataManager");
var GameGlobalVariable = require("AA_GameGlobalVariable");
var UI_MosterLogic = require("AA_UI_MosterLogic");
var UI_Player = require("AA_UI_Player");
var m = function (e) {
  function t() {
    var t = null !== e && e.apply(this, arguments) || this;
    t.ciTiaoData = [];
    t.offtime = 0;
    t.mosterbombCount = {};
    t.attackCount = {};
    t.nowguocount = 0;
    t.mosterbomb = {};
    t.liuliancountjilu = {};
    t.jiangecount = {};
    t.playerSendCount = {};
    return t;
  }
  __extends(t, e);
  t.prototype.addNowCiTiao = function (e) {
    this.addCiTiaoOne(e) || this.ciTiaoData.push(e);
  };
  t.prototype.isHaveShuiGuoBuff = function (e) {
    var t = null;
    for (var o = 0; o < this.ciTiaoData.length; o++) {
      var n = this.ciTiaoData[o];
      if (n.id == e) {
        t = n;
        break;
      }
    }
    return t;
  };
  t.prototype.saveNowCiTiao = function () {
    GameDataManager.GameDataMgr.updateCiTiao(GameGlobalVariable.GameGlobalVariable.nowlevel, this.ciTiaoData);
  };
  t.prototype.overAward = function (e) {
    var t = 0;
    for (var o = 0; o < this.ciTiaoData.length; o++) {
      var n = this.ciTiaoData[o];
      var i = Excel.Excel.shuiguobuff(n.citiaoshuzhitype);
      6 == i.buffefftype && (t += i.value[0]);
    }
    return e + t;
  };
  t.prototype.addCiTiaoOne = function (e) {
    var t = Excel.Excel.shuiguobuff(e.citiaoshuzhitype);
    var o = false;
    switch (t.buffefftype) {
      case 44:
        EventManager.EventMgr.dispatchEvent(EvenType.EVENT_TYPE.Game_Add_YinBi, t.value[0]);
        o = true;
    }
    return o;
  };
  t.prototype.setSaveCiTiao = function (e) {
    this.ciTiaoData = e;
  };
  t.prototype.getPlayerCiTiao = function (e) {
    var t = [];
    for (var o = 0; o < this.ciTiaoData.length; o++) {
      var n = this.ciTiaoData[o];
      1 != n.citiaochuxian && n.shuiguoId != e.playerId + 1e3 || t.push(n);
    }
    return t;
  };
  t.prototype.cleanNowCiTiao = function () {
    this.ciTiaoData = [];
    GameDataManager.GameDataMgr.updateCiTiao(GameGlobalVariable.GameGlobalVariable.nowlevel, null);
    EventManager.EventMgr.dispatchEvent(EvenType.EVENT_TYPE.Game_Add_CiTiao);
  };
  t.prototype.getNowCiTiao = function (e) {
    var t = Excel.Excel.shuiguocitiao_all;
    GameDataManager.GameDataMgr.gameBag.dressUpEquips;
    var o = [];
    var n = t.size;
    var i = function (e) {
      var t = Excel.Excel.shuiguocitiao(e);
      if (0 != t.citiaoshuzhitype && 60 != t.id && 64 != t.id) {
        var n = -1;
        -1 == t.citiaochuxian && (n = a.ciTiaoData.findIndex(function (e) {
          return e.id == t.id;
        }));
        if (-1 == n) {
          if (-1 == t.citiaochuxian) {
            PlayerDataManager.PlayerDataMgr.GetEquipIsDressUp(t.shuiguoId) && HallGlobalVariable.default.GetUnLockCiTiao(t) && o.push({
              index: e - 1,
              weight: t.weigth
            });
          } else {
            o.push({
              index: e - 1,
              weight: t.weigth
            });
          }
        }
      }
    };
    var a = this;
    for (var r = 1; r <= n; r++) {
      i(r);
    }
    if (e) {
      var c = this.renyiweightRandom(o);
      var s = o[c].index;
      o.splice(c, 1);
      var d = this.renyiweightRandom(o);
      var f = o[d].index;
      o.splice(d, 1);
      var g = this.renyiweightRandom(o);
      var _ = o[g].index;
      o.splice(g, 1);
      return [Excel.Excel.shuiguocitiao(s + 1), Excel.Excel.shuiguocitiao(f + 1), Excel.Excel.shuiguocitiao(_ + 1)];
    }
    var m = [];
    var y = [];
    for (r = 0; r < o.length; r++) {
      s = o[r].index;
      var v = Excel.Excel.shuiguocitiao(s + 1);
      3 == v.quality && m.length < 2 && m.push(r);
      2 == v.quality && y.length < 1 && y.push(r);
    }
    var b = [];
    b = (b = b.concat(m)).concat(y);
    var w = [];
    for (r = 0; r < b.length; r++) {
      var I = o[b[r]].index;
      w.push(I + 1);
    }
    return [Excel.Excel.shuiguocitiao(w[0]), Excel.Excel.shuiguocitiao(w[1]), Excel.Excel.shuiguocitiao(w[2])];
  };
  t.prototype.renyiweightRandom = function (e) {
    var t = 0;
    e.forEach(function (e) {
      t += e.weight;
    });
    t *= Math.random();
    for (var o = 0; o < e.length; o++) {
      if ((t -= e[o].weight) <= 0) {
        return o;
      }
    }
    return 0;
  };
  t.prototype.mosterBeHit = function (e, t) {
    var o = null;
    for (var n = 0; n < this.ciTiaoData.length; n++) {
      var i = this.ciTiaoData[n];
      var a = Excel.Excel.shuiguobuff(i.citiaoshuzhitype);
      if (i.shuiguoId == t.playerId + 1e3) {
        if (1 == a.buffefftype) {
          if (o) {
            o.bufftime < a.bufftime && (o = a);
          } else {
            o = a;
          }
        } else {
          e.onSpeedJian(a, t);
        }
      }
      24 == a.buffefftype && t.kuangrePlayer && e.onSpeedJian(a, t);
    }
    var r = Excel.Excel.shuiguobuff(t.sgtianfuid);
    r && e.onSpeedJian(r, t);
    o && e.onSpeedJian(o, t);
    var c = ExcelUtil.ExcelUtil.getSameData(Excel.Excel.shuiguohecheng_all, "shuiguoId", t.playerId + 1e3)[t.playerInfo.equipLevel];
    if (c) {
      var s = Excel.Excel.shuiguobuff(c.newTianFuBuff);
      s && e.onSpeedJian(s, t);
    }
  };
  t.prototype.getDuWu = function () {
    var e = null;
    for (var t = 0; t < this.ciTiaoData.length; t++) {
      var o = this.ciTiaoData[t];
      var n = Excel.Excel.shuiguobuff(o.citiaoshuzhitype);
      37 == n.buffefftype && (e = n);
    }
    return e;
  };
  t.prototype.getDuShang = function () {
    var e = null;
    for (var t = 0; t < this.ciTiaoData.length; t++) {
      var o = this.ciTiaoData[t];
      var n = Excel.Excel.shuiguobuff(o.citiaoshuzhitype);
      41 == n.buffefftype && (e = n);
    }
    return e;
  };
  t.prototype.addMosterBombCount = function (e) {
    var t = this.mosterbombCount[e.node.uuid];
    t || (t = 0);
    t += 1;
    this.mosterbombCount[e.node.uuid] = t;
  };
  t.prototype.cleanMosterBombCount = function (e) {
    delete this.mosterbombCount[e.node.uuid];
  };
  t.prototype.getMosterBombCountHangHai = function (e) {
    var t = false;
    for (var o = 0; o < this.ciTiaoData.length; o++) {
      var n = this.ciTiaoData[o];
      31 == Excel.Excel.shuiguobuff(n.citiaoshuzhitype).buffefftype && (t = true);
    }
    var i = 0;
    if (t) {
      var a = this.mosterbombCount[e.node.uuid];
      a || (a = 0);
      i = .1 * a;
    }
    return i;
  };
  t.prototype.getMosterBombZengShang = function () {
    var e = 0;
    for (var t = 0; t < this.ciTiaoData.length; t++) {
      var o = this.ciTiaoData[t];
      var n = Excel.Excel.shuiguobuff(o.citiaoshuzhitype);
      29 == n.buffefftype && (e = n.value[0] / 100);
    }
    return e;
  };
  t.prototype.erjiShuiGuoBuff = function () {
    var e = null;
    for (var t = 0; t < this.ciTiaoData.length; t++) {
      var o = this.ciTiaoData[t];
      var n = Excel.Excel.shuiguobuff(o.citiaoshuzhitype);
      45 == n.buffefftype && (e = n);
    }
    return e;
  };
  t.prototype.addPlayerAttack = function (e, t) {
    var o = Excel.Excel.shuiguobuff(t.sgtianfuid);
    o && 16 != o.buffefftype && (o = null);
    var n = 0;
    var i = 0;
    if (!o) {
      var a = ExcelUtil.ExcelUtil.getSameData(Excel.Excel.shuiguohecheng_all, "shuiguoId", t.playerId + 1e3)[t.playerInfo.equipLevel];
      a && (o = Excel.Excel.shuiguobuff(a.newTianFuBuff));
    }
    if (o) {
      if (16 != o.buffefftype) {
        return 0;
      }
      n = o.value[0] / 100;
      var r = this.attackCount[e.node.uuid];
      r || (r = {});
      if (null == (i = r[t.node.uuid])) {
        i = 0;
      } else {
        i += 1;
      }
      r[t.node.uuid] = i;
      this.attackCount[e.node.uuid] = r;
      i > o.value[1] && (i = o.value[1]);
    }
    return n * i;
  };
  t.prototype.cleanMosterDieJia = function (e) {
    delete this.attackCount[e.node.uuid];
  };
  t.prototype.boshuAttackAdd = function () {
    for (var e = 0; e < this.ciTiaoData.length; e++) {
      var t = this.ciTiaoData[e];
      48 == Excel.Excel.shuiguobuff(t.citiaoshuzhitype).buffefftype && (this.nowguocount += 1);
    }
  };
  t.prototype.getAttackAdd = function () {
    var e = null;
    for (var t = 0; t < this.ciTiaoData.length; t++) {
      var o = this.ciTiaoData[t];
      var n = Excel.Excel.shuiguobuff(o.citiaoshuzhitype);
      if (48 == n.buffefftype) {
        e = n;
        break;
      }
    }
    if (e) {
      var i = e.value[0] * this.nowguocount;
      i > e.value[1] && (i = e.value[1]);
      return i / 100;
    }
    return 0;
  };
  t.prototype.resetNowGuo = function () {
    this.nowguocount = 0;
  };
  t.prototype.playerAttackFangshiIng = function (e, t) {
    var o = null;
    for (var n = 0; n < this.ciTiaoData.length; n++) {
      var i = this.ciTiaoData[n];
      if (i.shuiguoId == e.playerId + 1e3) {
        var a = Excel.Excel.shuiguobuff(i.citiaoshuzhitype);
        if (14 == a.buffefftype) {
          o = a;
          break;
        }
      }
    }
    var r = t;
    if (o) {
      switch (o.buffefftype) {
        case 14:
          r = 2;
      }
    }
    return r;
  };
  t.prototype.playAttackJiaCheng = function (e, t, o) {
    var n = 0;
    var i = false;
    var a = false;
    for (var r = 0; r < this.ciTiaoData.length; r++) {
      var c = this.ciTiaoData[r];
      92 == (u = Excel.Excel.shuiguobuff(c.citiaoshuzhitype)).id && (i = true);
      93 == u.id && (a = true);
      if (c.shuiguoId == e.playerId + 1e3 || 1 == c.citiaochuxian) {
        switch (o) {
          case 1:
            15 == u.buffefftype && (n += u.value[0] / 100);
            38 == u.buffefftype && (n += u.value[0] / 100);
            break;
          case 2:
            17 == u.buffefftype && (n += u.value[0] / 100) > 3 && (n = 3);
            if (33 == u.buffefftype) {
              d = this.playerSendCount[e.node.uuid];
              if (!d) {
                d = 1;
              }
              d > 15 && (d = 15);
              n += u.value[0] / 100 * d;
            }
        }
      }
      if (2 == o && 3 != e.playerId && 28 == u.buffefftype) {
        var s = this.getBeOhterShuiGuoBuff(e);
        n += u.value[0] / 100 * s;
      }
      if (1 == o && 3 != e.playerId && 9 == u.buffefftype) {
        s = this.getBeOhterShuiGuoBuff(e);
        n += u.value[0] / 100 * s;
      }
    }
    if (o = 1) {
      if (i) {
        var u = Excel.Excel.shuiguobuff(92);
        var d = this.getTongLiePlayer(e);
        u && (n += u.value[0] / 100 * d);
      }
      if (15 == e.playerId && 4 == e.playerInfo.equipLevel && a && (u = Excel.Excel.shuiguobuff(93))) {
        d = this.getTongLiePlayer(e, true);
        n += u.value[0] / 100 * d;
      }
    }
    if (e.kuangrePlayer) {
      var p = this.addTianFu(e);
      for (r = 0; r < p.length; r++) {
        var h = p[r];
        40 == h.buffefftype && e.kuangrePlayer && (n += h.value[0] / 100);
      }
    }
    switch (o) {
      case 1:
        t += t * (n + this.getAttackAdd());
        break;
      case 2:
        t /= 1 + n;
    }
    return t;
  };
  t.prototype.getZhanShaBuff = function () {
    var e = null;
    for (var t = 0; t < this.ciTiaoData.length; t++) {
      var o = this.ciTiaoData[t];
      var n = Excel.Excel.shuiguobuff(o.citiaoshuzhitype);
      if (93 == n.id) {
        e = n;
        break;
      }
    }
    return e;
  };
  t.prototype.getBackBuff = function (e) {
    var t = null;
    for (var o = 0; o < this.ciTiaoData.length; o++) {
      var n = this.ciTiaoData[o];
      if (95 == (i = Excel.Excel.shuiguobuff(n.citiaoshuzhitype)).id) {
        t = i;
        break;
      }
    }
    if (t) {
      return t;
    }
    var i;
    var a = Excel.Excel.shuiguo(e);
    return Excel.Excel.shuiguobuff(a.talent);
  };
  t.prototype.getTongLiePlayer = function (e, t) {
    undefined === t && (t = false);
    var o = 0;
    if (e.node.parent) {
      var n = e.node.parent.children;
      var i = [];
      for (var a = 0; a < n.length; a++) {
        var r = n[a].getComponent(UI_Player.default);
        16 == r.playerId && i.push(r.node);
      }
      for (a = 0; a < i.length; a++) {
        var c = i[a];
        if (c.uuid != e.node.uuid) {
          var s = e.node.x - e.node.width / 2;
          var u = e.node.x + e.node.width / 2;
          var l = c.x - c.width / 2;
          var d = c.x + c.width / 2;
          var p = e.node.y - e.node.height / 2;
          var h = e.node.y + e.node.height / 2;
          var f = c.y - c.height / 2;
          var g = c.y + c.height / 2;
          if (l <= s && d >= s || l <= u && d >= u) {
            if (t) {
              (Math.abs(h - f) < 50 || Math.abs(p - g) < 50) && (o += 1);
            } else {
              o += 1;
            }
          }
        }
      }
    }
    return o;
  };
  t.prototype.getMosterAllShangHai = function (e) {
    var t = 0;
    for (var o = 0; o < this.ciTiaoData.length; o++) {
      var n = this.ciTiaoData[o];
      var i = Excel.Excel.shuiguobuff(n.citiaoshuzhitype);
      1 == n.citiaochuxian && 43 == i.buffefftype && (t += i.value[0] / 100);
    }
    return e + e * t;
  };
  t.prototype.getFanBei = function () {
    var e = null;
    for (var t = 0; t < this.ciTiaoData.length; t++) {
      var o = this.ciTiaoData[t];
      var n = Excel.Excel.shuiguobuff(o.citiaoshuzhitype);
      54 == n.buffefftype && (e = n);
    }
    var i = 0;
    e && (i = e.value[0] / 100);
    return i;
  };
  t.prototype.getMosterBombJiaCheng = function (e) {
    var t = 0;
    for (var o = 0; o < this.ciTiaoData.length; o++) {
      var n = this.ciTiaoData[o];
      var i = Excel.Excel.shuiguobuff(n.citiaoshuzhitype);
      if (31 == i.buffefftype && this.mosterbomb[e.node.uuid]) {
        t += i.value[0] / 100;
        break;
      }
    }
    return t;
  };
  t.prototype.getLiuXueJiaCheng = function (e) {
    var t = 0;
    for (var o = 0; o < this.ciTiaoData.length; o++) {
      var n = this.ciTiaoData[o];
      var i = Excel.Excel.shuiguobuff(n.citiaoshuzhitype);
      if (e.playerId + 1e3 == n.shuiguoId && 49 == i.buffefftype) {
        t += i.value[0] / 100;
        break;
      }
    }
    return t;
  };
  t.prototype.setMosterBomb = function (e) {
    this.mosterbomb[e] = "ok";
  };
  t.prototype.cleanMosterBomb = function (e) {
    delete this.mosterbomb[e];
  };
  t.prototype.getBombBuffScope = function (e) {
    var t = 0;
    for (var o = 0; o < this.ciTiaoData.length; o++) {
      var n = this.ciTiaoData[o];
      if (n.shuiguoId == e.playerId + 1e3) {
        var i = Excel.Excel.shuiguobuff(n.citiaoshuzhitype);
        4 == i.buffefftype && (t += i.value[0] / 100);
      }
    }
    return t;
  };
  t.prototype.setBombShanHai = function (e, t) {
    var n = null;
    for (var i = 0; i < this.ciTiaoData.length; i++) {
      var r = this.ciTiaoData[i];
      if (r.shuiguoId == e.playerId + 1e3) {
        var c = Excel.Excel.shuiguobuff(r.citiaoshuzhitype);
        if (42 == c.buffefftype) {
          n = c;
          break;
        }
      }
    }
    if (n) {
      EventManager.EventMgr.dispatchEvent(EvenType.EVENT_TYPE.Game_Add_BaoZha, t.node.getPosition(), 2, n.value[0]);
      var u = t.getNowMosterNode(n.value[0]);
      var d = exports.BuffMgr.playAttackJiaCheng(e, e.sgattack, 1);
      d += d * n.value[1] / 100;
      u.forEach(function (t) {
        t.getComponent(UI_MosterLogic.default).fujiaAttack(d, 1, e);
      });
    }
  };
  t.prototype.getFanweiBuff = function (e) {
    var t = null;
    for (var o = 0; o < this.ciTiaoData.length; o++) {
      var n = this.ciTiaoData[o];
      if (n.shuiguoId == e.playerId + 1e3) {
        var i = Excel.Excel.shuiguobuff(n.citiaoshuzhitype);
        if (36 == i.buffefftype) {
          t = i;
          break;
        }
      }
    }
    return t;
  };
  t.prototype.getBombBuff = function (e) {
    var t = null;
    for (var o = 0; o < this.ciTiaoData.length; o++) {
      var n = this.ciTiaoData[o];
      if (n.shuiguoId == e.playerId + 1e3 && 4 == (i = Excel.Excel.shuiguobuff(n.citiaoshuzhitype)).buffefftype) {
        t = i;
        break;
      }
    }
    if (!t) {
      var i;
      var a = ExcelUtil.ExcelUtil.getSameData(Excel.Excel.shuiguohecheng_all, "shuiguoId", e.playerId + 1e3)[e.playerInfo.equipLevel];
      a && (i = Excel.Excel.shuiguobuff(a.newTianFuBuff)) && 4 == i.buffefftype && (t = i);
    }
    return t;
  };
  t.prototype.getLanGuaErwai = function (e) {
    var t = null;
    for (var o = 0; o < this.ciTiaoData.length; o++) {
      var n = this.ciTiaoData[o];
      if (n.shuiguoId == e.playerId + 1e3) {
        var i = Excel.Excel.shuiguobuff(n.citiaoshuzhitype);
        if (32 == i.buffefftype) {
          t = i;
          break;
        }
      }
    }
    return t;
  };
  t.prototype.getBeOhterShuiGuoBuff = function (e) {
    var t = 0;
    if (e.node.parent) {
      var o = e.node.parent.children;
      for (var n = 0; n < o.length; n++) {
        var i = o[n];
        if (e.node.uuid != i.uuid && 3 == i.getComponent(UI_Player.default).playerId) {
          var a = i.getChildByName("dir").children;
          for (var r = 0; r < a.length; r++) {
            var s = a[r];
            var u = s.x + i.x;
            var l = s.y + i.y;
            if (CommonUtils.default.pointInRect(cc.v2(u, l), e.node)) {
              t++;
              break;
            }
          }
        }
      }
    }
    return t;
  };
  t.prototype.getLiuLianBuff = function (e) {
    var t = null;
    for (var o = 0; o < this.ciTiaoData.length; o++) {
      var n = this.ciTiaoData[o];
      if (n.shuiguoId == e.playerId + 1e3 || !n.shuiguoId) {
        var i = Excel.Excel.shuiguobuff(n.citiaoshuzhitype);
        30 == i.buffefftype && (t = i);
      }
    }
    if (t) {
      var a = this.liuliancountjilu[e.node.uuid];
      if (null == a) {
        a = 1;
      } else {
        a += 1;
      }
      this.liuliancountjilu[e.node.uuid] = a;
      if (a > 3) {
        this.liuliancountjilu[e.node.uuid] = undefined;
        return t;
      } else {
        return null;
      }
    }
    return null;
  };
  t.prototype.getLiuLianBomb = function (e) {
    var t = null;
    var o = ExcelUtil.ExcelUtil.getSameData(Excel.Excel.shuiguohecheng_all, "shuiguoId", e.playerId + 1e3)[e.playerInfo.equipLevel];
    if (o) {
      var n = Excel.Excel.shuiguobuff(o.newTianFuBuff);
      n && 49 == n.buffefftype && (t = n);
    }
    return t;
  };
  t.prototype.cleanLiuLian = function () {
    this.liuliancountjilu = {};
  };
  t.prototype.getAttackBaoJi = function (e, t) {
    undefined === t && (t = false);
    var o = 0;
    var n = 0;
    var i = null;
    for (var a = 0; a < this.ciTiaoData.length; a++) {
      var r = this.ciTiaoData[a];
      if (e.kuangrePlayer && e.kuangrePlayer.playerId + 1e3 == r.shuiguoId) {
        var c = Excel.Excel.shuiguobuff(r.citiaoshuzhitype);
        26 == c.buffefftype && (o += c.value[0] / 100);
        23 == c.buffefftype && (n += c.value[0] / 100);
      }
      if (r.shuiguoId == e.playerId + 1e3 || !r.shuiguoId) {
        var s = Excel.Excel.shuiguobuff(r.citiaoshuzhitype);
        12 == s.buffefftype && (o += s.value[0] / 100);
        13 == s.buffefftype && (n += s.value[0] / 100);
        34 == s.buffefftype && (i = s);
      }
    }
    if (i) {
      var u = this.jiangecount[e.node.uuid];
      u || (u = 0);
      t || (u += 1);
      this.jiangecount[e.node.uuid] = u;
      if (u > i.value[0]) {
        this.jiangecount[e.node.uuid] = 0;
        o = 1;
      }
    }
    var d = this.getMyWuJieBoaji(e);
    var p = Excel.Excel.shuiguobuff(84);
    p && (o += p.value[0] / 100 * d);
    return {
      baojijilv: o,
      baojijiacheng: n
    };
  };
  t.prototype.getLajiaoBiSha = function (e, t) {
    undefined === t && (t = 1);
    if (e.kuangrePlayer && 4 == e.kuangrePlayer.playerInfo.equipLevel) {
      var o = Excel.Excel.shuiguobuff(84);
      return !!(o && Math.random() <= o.value[1] / 100 / t);
    }
    return false;
  };
  t.prototype.getMyWuJieBoaji = function (e) {
    var t = 0;
    if (e.node.parent) {
      var o = e.node.parent.children;
      var n = [];
      for (var i = 0; i < o.length; i++) {
        var a = o[i].getComponent(UI_Player.default);
        11 == a.playerId && 4 == a.playerInfo.equipLevel && n.push(a.node);
      }
      for (i = 0; i < n.length; i++) {
        var r = n[i];
        var c = e.node.y - e.node.height / 2;
        var s = e.node.y + e.node.height / 2;
        var u = r.y - r.height / 2;
        var l = r.y + r.height / 2;
        (u < c && l > c || u < s && l > s) && (t += 1);
      }
    }
    return t;
  };
  t.prototype.getKuangReOver = function () {
    var e = false;
    for (var t = 0; t < this.ciTiaoData.length; t++) {
      var o = this.ciTiaoData[t];
      25 == Excel.Excel.shuiguobuff(o.citiaoshuzhitype).buffefftype && (e = true);
    }
    return e;
  };
  t.prototype.getNinMengReal = function (e) {
    var t = e.node.parent.children;
    var o = [];
    for (var n = 0; n < t.length; n++) {
      var i = t[n];
      if (i.uuid != e.node.uuid) {
        var a = i.getComponent(UI_Player.default);
        if (3 == a.playerId) {
          var r = i.getChildByName("dir").children;
          for (var s = 0; s < r.length; s++) {
            var u = r[s];
            var l = u.x + i.x;
            var d = u.y + i.y;
            if (CommonUtils.default.pointInRect(cc.v2(l, d), e.node)) {
              break;
            }
          }
          o.push(a);
        }
      }
    }
    return o;
  };
  t.prototype.getAttackGuding = function (e) {
    var t = 0;
    for (var o = 0; o < this.ciTiaoData.length; o++) {
      var n = this.ciTiaoData[o];
      var i = Excel.Excel.shuiguobuff(n.citiaoshuzhitype);
      if (21 == i.buffefftype) {
        var a = this.getBeOhterShuiGuoBuff(e);
        t += i.value[0] * a;
      }
    }
    var r = this.getNinMengReal(e);
    for (o = 0; o < r.length; o++) {
      var c = r[o];
      var s = Excel.Excel.shuiguo(c.playerId + 1e3);
      var u = Excel.Excel.shuiguobuff(s.talent);
      t += this.getNinMengRes(c, u);
    }
    return t;
  };
  t.prototype.getNinMengRes = function (e, t) {
    var o = ExcelUtil.ExcelUtil.getSameData(Excel.Excel.shuiguolevel_all, "shuiguoId", e.playerId + 1e3);
    var n = t.value[0];
    var i = 0;
    var a = PlayerDataManager.PlayerDataMgr.GetEquipDataById(e.playerId + 1e3).level;
    for (var r = 0; r < o.length; r++) {
      r + 1 <= a && r > 0 && (i += o[r - 1].addbeidongbuff[0]);
    }
    var c = ExcelUtil.ExcelUtil.getSameData(Excel.Excel.shuiguohecheng_all, "shuiguoId", e.playerId + 1e3)[e.playerInfo.equipLevel];
    var s = 0;
    c && (s = c.addbeidongbuff[0] / 100);
    return n * (1 + s) + i;
  };
  t.prototype.addTianFu = function (e) {
    var t = [];
    if (e.kuangrePlayer) {
      var o = Excel.Excel.shuiguobuff(e.kuangrePlayer.sgtianfuid);
      o && t.push(o);
    }
    return t;
  };
  t.prototype.addPlayerSendCount = function (e) {
    var t = this.playerSendCount[e.node.uuid];
    t || (t = 0);
    t++;
    this.playerSendCount[e.node.uuid] = t;
  };
  t.prototype.clearPlayerSendCount = function (e) {
    delete this.playerSendCount[e.node.uuid];
  };
  t.prototype.playerJingYanValue = function (e) {
    var t = 0;
    for (var o = 0; o < this.ciTiaoData.length; o++) {
      var n = this.ciTiaoData[o];
      47 == Excel.Excel.shuiguobuff(n.citiaoshuzhitype).buffefftype && (t += Excel.Excel.shuiguobuff(n.citiaoshuzhitype).value[0] / 100);
    }
    return e + e * t;
  };
  t.prototype.getDieJia = function (e) {
    var t = false;
    for (var o = 0; o < this.ciTiaoData.length; o++) {
      var n = this.ciTiaoData[o];
      n.shuiguoId == e.playerId + 1e3 && 35 == Excel.Excel.shuiguobuff(n.citiaoshuzhitype).buffefftype && (t = true);
    }
    return t;
  };
  t.prototype.getNowSpeedBiLi = function () {
    var e = 0;
    for (var t = 0; t < this.ciTiaoData.length; t++) {
      var o = this.ciTiaoData[t];
      var n = Excel.Excel.shuiguobuff(o.citiaoshuzhitype);
      switch (n.buffefftype) {
        case 19:
          e += n.value[0] / 100;
      }
    }
    return e;
  };
  t.prototype.getLianXuAttack = function (e) {
    var t = null;
    for (var o = 0; o < this.ciTiaoData.length; o++) {
      var n = this.ciTiaoData[o];
      var i = Excel.Excel.shuiguobuff(n.citiaoshuzhitype);
      if (e.playerId + 1e3 == n.shuiguoId && 18 == i.buffefftype) {
        t = i;
        break;
      }
    }
    return !!t;
  };
  t.prototype.getShuiGuoBuff = function (e, t) {
    var o = Excel.Excel.shuiguo(e);
    var n = Excel.Excel.shuiguobuff(o.talent);
    var i = n.value[0];
    switch (e) {
      case 1002:
        i = this.getShuiGuoJiaCheng(t);
        break;
      case 1003:
        i = this.getHaMiGuaJiaCheng(t);
    }
    var a = -1;
    n.value[1] && (a = n.value[1]);
    return {
      nowvalue: i,
      otherValue: a
    };
  };
  t.prototype.getShuiGuoJiaCheng = function (e) {
    var t = Excel.Excel.shuiguo(1002);
    var o = ExcelUtil.ExcelUtil.getSameData(Excel.Excel.shuiguohecheng_all, "shuiguoId", 1002)[e];
    var n = Excel.Excel.shuiguobuff(t.talent).value[0];
    var i = 0;
    o.addbeidongbuff[0] && (i = o.addbeidongbuff[0] / 100);
    return n + n * i;
  };
  t.prototype.getHaMiGuaJiaCheng = function (e) {
    var t = Excel.Excel.shuiguo(1003);
    var o = ExcelUtil.ExcelUtil.getSameData(Excel.Excel.shuiguohecheng_all, "shuiguoId", 1003)[e];
    var n = Excel.Excel.shuiguobuff(t.talent).value[0];
    var i = 0;
    o.addbeidongbuff[0] && (i = o.addbeidongbuff[0] / 100);
    return n + n * i;
  };
  t.prototype.setKuangReBuff = function (e) {
    if (e.node.parent) {
      var t = e.node.parent.children;
      var o = [];
      for (var n = 0; n < t.length; n++) {
        var i = t[n];
        if (i.uuid != e.node.uuid) {
          var a = i.getComponent(UI_Player.default);
          null == a.kuangrePlayer && 5 != a.sgattacktagtype && 8 != a.sgattacktagtype && 9 != a.sgattacktagtype && o.push(a);
        }
      }
      var r = o[CommonUtils.default.getRandomInt(0, o.length - 1)];
      r && r.setKuangRe(e);
    }
  };
  return t;
}(SingletonManager.SingletonMgr);
exports.BuffMgr = m.getInstance();